﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sy1_7
{
    public partial class Form1 : Form
    {
        private int currentWidth = 240;
        private int currentHeight = 180;
        private readonly int minWidth = 24;
        private readonly int minHeight = 18;
        private readonly int maxWidth = 240;
        private readonly int maxHeigth = 180;
        public Form1()
        {
            InitializeComponent();
            Load += Form1_Load;
            button1.Click += button1_Click;
            button2.Click += button2_Click;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            pictureBox1.Image = Image.FromFile("tu.jpg");
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox1.Size = new Size(currentWidth, currentHeight);
            button1.Enabled = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            currentWidth += 24;
            currentHeight += 18;
            pictureBox1.Size = new Size(currentWidth, currentHeight);
            if (currentWidth == maxWidth && currentHeight == maxHeigth ) ;
            {
                button1.Enabled = false;
            }
            button2.Enabled = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            currentWidth -= 24;
            currentHeight -= 18;
            pictureBox1.Size = new Size(currentWidth, currentHeight);
            if (currentWidth == minWidth && currentHeight == minHeight)
            {
                button2.Enabled = false;
            }
            button1.Enabled = true;
        }
    }
}
